package com.ocom.xfrecode.mongo.service;

import cn.hutool.core.convert.Convert;
import com.dangdang.ddframe.rdb.sharding.id.generator.IdGenerator;
import com.ocom.xfrecode.mongo.DeviceHistoryRepository;
import com.ocom.xfrecode.mongo.po.EntityDeviceHistory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class DeviceHistoryService {
    @Autowired
    private DeviceHistoryRepository repository;

    @Autowired
    private IdGenerator idGenerator;
    public EntityDeviceHistory save(EntityDeviceHistory entity) {
        entity.setCreateTime(new Date());
        entity.setId(idGenerator.generateId().longValue());
        return repository.save(entity);
    }
}
